<?php
/* 
 * 运营日志管理
 */
class Operation_logAction extends CommonAction {
    //TODO
    public function _filter(&$map) {
        $key = trim($_REQUEST['keywords']);
        if(!empty($key)) {
            $map['note'] = array('like',"%".$key."%");//备注信息
            $map['title'] = array('like',"%".$key."%");//锚文本
            $map['webname'] = array('like',"%".$key."%");//网站名称
            $map['url'] = array('like',"%".$key."%");//url
            $map['_logic'] = "or";
        }
         if( $_REQUEST['object'] != '' )
             $map['object'] = array('like',"%". trim($_REQUEST['object'])."%");
         if( $_REQUEST['shop_id'] != '' )
             $map['shop_id'] = trim($_REQUEST['shop_id']);
         if( $_REQUEST['obj_id'] != '' )
             $map['obj_id'] = trim($_REQUEST['obj_id']);
         if( $_REQUEST['operation_field'] != '' )
             $map['field'] = trim($_REQUEST['operation_field']);
         if( $_REQUEST['old'] != '' )
             $map['old'] = array('like',"%". trim($_REQUEST['old'])."%");
         if( $_REQUEST['new'] != '' )
             $map['new'] = array('like',"%". trim($_REQUEST['new'])."%");
         if( $_REQUEST['remark'] != '' )
             $map['remark'] = array('like',"%". trim($_REQUEST['remark'])."%");
    }

    function _before_insert(){
       $_POST['create_time'] = strtotime($_POST['create_time']);
    }
    function _before_update(){
       $_POST['create_time'] = strtotime($_POST['create_time']);
    }

    public function add(){
       $this->edit('Operation_log','add');
    }

}
?>
